//    Copyright (C) Kherty.  All rights reserved.
using System;
using OpenLS.Core.Serialization;
using OpenLS.Vml.Serialization;

namespace OpenLS.Vml.Drawing
{
    internal class Extrusion : ShapeElement
    {
        private Ext? _ext;
        private bool? _on;
        private string _viewpointorigin;
        private string _viewpoint;
        private ExtrusionRender _render;
        private double? _skewangle;
        private string _skewamt;
        private string _foredepth;
        private string _backdepth;
        private double? _orientationangle;
        private bool? _lockrotationcenter;
        private string _orientation;
        private bool? _autorotationcenter;
        private string _rotationcenter;
        private string _rotationangle;
        private ColorMode? _colormode;
        private string _color;
        private double? _shininess;
        private string _specularity;
        private string _diffusity;
        private bool? _metal;
        private string _edge;
        private string _facet;
        private ExtrusionType _type;
        private ExtrusionPlane _plane;
        private string _brightness;
        private string _lightposition;
        private string _lightlevel;
        private bool? _lightharsh;
        private string _lightposition2;
        private string _lightlevel2;
        private bool? _lightharsh2;
        private bool? _lightface;

        public Ext? Ext
        {
            get { return _ext; }
            set { _ext = value; }
        }

        public bool? On
        {
            get { return _on; }
            set { _on = value; }
        }

        public string ViewpointOrigin
        {
            get { return _viewpointorigin; }
            set { _viewpointorigin = value; }
        }

        public string Viewpoint
        {
            get { return _viewpoint; }
            set { _viewpoint = value; }
        }

        public ExtrusionRender Render
        {
            get { return _render; }
            set { _render = value; }
        }

        public double? SkewAngle
        {
            get { return _skewangle; }
            set { _skewangle = value; }
        }

        public string SkewAmount
        {
            get { return _skewamt; }
            set { _skewamt = value; }
        }

        public string ForegroundDepth
        {
            get { return _foredepth; }
            set { _foredepth = value; }
        }

        public string BackDepth
        {
            get { return _backdepth; }
            set { _backdepth = value; }
        }

        public double? OrientationAngle
        {
            get { return _orientationangle; }
            set { _orientationangle = value; }
        }

        public bool? LockRotationCenter
        {
            get { return _lockrotationcenter; }
            set { _lockrotationcenter = value; }
        }

        public string Orientation
        {
            get { return _orientation; }
            set { _orientation = value; }
        }

        public bool? AutoRotationCenter
        {
            get { return _autorotationcenter; }
            set { _autorotationcenter = value; }
        }

        public string RotationCenter
        {
            get { return _rotationcenter; }
            set { _rotationcenter = value; }
        }

        public string RotationAngle
        {
            get { return _rotationangle; }
            set { _rotationangle = value; }
        }

        public ColorMode? ColorMode
        {
            get { return _colormode; }
            set { _colormode = value; }
        }

        public string Color
        {
            get { return _color; }
            set { _color = value; }
        }

        public double? Shininess
        {
            get { return _shininess; }
            set { _shininess = value; }
        }

        public string Specularity
        {
            get { return _specularity; }
            set { _specularity = value; }
        }

        public string Diffusity
        {
            get { return _diffusity; }
            set { _diffusity = value; }
        }

        public bool? Metal
        {
            get { return _metal; }
            set { _metal = value; }
        }

        public string Edge
        {
            get { return _edge; }
            set { _edge = value; }
        }

        public string Facet
        {
            get { return _facet; }
            set { _facet = value; }
        }

        public ExtrusionType Type
        {
            get { return _type; }
            set { _type = value; }
        }

        public ExtrusionPlane Plane
        {
            get { return _plane; }
            set { _plane = value; }
        }

        public string Brightness
        {
            get { return _brightness; }
            set { _brightness = value; }
        }

        public string LightPosition
        {
            get { return _lightposition; }
            set { _lightposition = value; }
        }

        public string LightLevel
        {
            get { return _lightlevel; }
            set { _lightlevel = value; }
        }

        public bool? LightHarsh
        {
            get { return _lightharsh; }
            set { _lightharsh = value; }
        }

        public string LightPosition2
        {
            get { return _lightposition2; }
            set { _lightposition2 = value; }
        }

        public string LightLevel2
        {
            get { return _lightlevel2; }
            set { _lightlevel2 = value; }
        }

        public bool? LightHarsh2
        {
            get { return _lightharsh2; }
            set { _lightharsh2 = value; }
        }

        public bool? LightFace
        {
            get { return _lightface; }
            set { _lightface = value; }
        }

        internal override void ReadXmlCore(ReadContext context)
        {
            using (var c = context.Read(VmlConstants.OfficeNamespace + "extrusion"))
            {
                Ext = c.GetOptionalEnum<Ext>(VmlConstants.VmlNamespace + "ext");
                On = c.GetOptionalBoolean("on");
                Type = c.GetOptionalEnum("type", ExtrusionType.Parallel);
                Render = c.GetOptionalEnum("render", ExtrusionRender.Solid);
                ViewpointOrigin = c.GetOptionalString("viewpointorigin");
                Viewpoint = c.GetOptionalString("viewpoint");
                Plane = c.GetOptionalEnum("plane", ExtrusionPlane.XY);
                SkewAngle = c.GetOptionalDouble("skewangle");
                SkewAmount = c.GetOptionalString("skewamt");
                ForegroundDepth= c.GetOptionalString("foredepth");
                BackDepth = c.GetOptionalString("backdepth");
                Orientation = c.GetOptionalString("orientation");
                OrientationAngle = c.GetOptionalDouble("orientationangle");
                LockRotationCenter = c.GetOptionalBoolean("lockrotationcenter");
                AutoRotationCenter = c.GetOptionalBoolean("autorotationcenter");
                RotationCenter = c.GetOptionalString("rotationcenter");
                RotationAngle = c.GetOptionalString("rotationangle");
                ColorMode = c.GetOptionalEnum<ColorMode>("colormode");
                Color = c.GetOptionalString("color");
                Shininess = c.GetOptionalDouble("shininess");
                Specularity = c.GetOptionalString("specularity");
                Diffusity = c.GetOptionalString("diffusity");
                Metal = c.GetOptionalBoolean("metal");
                Edge = c.GetOptionalString("edge");
                Facet = c.GetOptionalString("facet");
                LightFace = c.GetOptionalBoolean("lightface");
                Brightness = c.GetOptionalString("brightness");
                LightPosition = c.GetOptionalString("lightposition");
                LightLevel = c.GetOptionalString("lightlevel");
                LightHarsh = c.GetOptionalBoolean("lightharsh");
                LightPosition2 = c.GetOptionalString("lightposition2");
                LightLevel2 = c.GetOptionalString("lightlevel2");
                LightHarsh2 = c.GetOptionalBoolean("lightharsh2");
            }
        }

        internal override void WriteXmlCore(WriteContext context)
        {
            using (var c = context.Write(VmlConstants.OfficeNamespace + "extrusion"))
            {
                c.SetOptionalEnum(VmlConstants.VmlNamespace + "ext", Ext);
                c.SetOptionalBoolean("on", On );
                c.SetOptionalEnum("type",Type,  ExtrusionType.Parallel);
                c.SetOptionalEnum("render", Render, ExtrusionRender.Solid);
                c.SetOptionalString("viewpointorigin", ViewpointOrigin);
                c.SetOptionalString("viewpoint", Viewpoint);
                c.SetOptionalEnum("plane", ExtrusionPlane.XY, Plane);
                c.SetOptionalDouble("skewangle", SkewAngle);
                c.SetOptionalString("skewamt", SkewAmount);
                c.SetOptionalString("foredepth", ForegroundDepth);
                c.SetOptionalString("backdepth", BackDepth);
                c.SetOptionalString("orientation", Orientation);
                c.SetOptionalDouble("orientationangle", OrientationAngle);
                c.SetOptionalBoolean("lockrotationcenter", LockRotationCenter);
                c.SetOptionalBoolean("autorotationcenter", AutoRotationCenter);
                c.SetOptionalString("rotationcenter", RotationCenter);
                c.SetOptionalString("rotationangle", RotationAngle);
                c.SetOptionalEnum("colormode", ColorMode);
                c.SetOptionalString("color", Color);
                c.SetOptionalDouble("shininess", Shininess);
                c.SetOptionalString("specularity", Specularity);
                c.SetOptionalString("diffusity", Diffusity);
                c.SetOptionalBoolean("metal", Metal);
                c.SetOptionalString("edge", Edge);
                c.SetOptionalString("facet", Facet);
                c.SetOptionalBoolean("lightface", LightFace);
                c.SetOptionalString("brightness", Brightness);
                c.SetOptionalString("lightposition", LightPosition);
                c.SetOptionalString("lightlevel", LightLevel);
                c.SetOptionalBoolean("lightharsh", LightHarsh);
                c.SetOptionalString("lightposition2", LightPosition2);
                c.SetOptionalString("lightlevel2", LightLevel2);
                c.SetOptionalBoolean("lightharsh2", LightHarsh2);
            }
        }
    }
}
    ;